<template>
	<fixtitletopVue>
		<template #l>
			<view @click="back" class="iconfont icon-31fanhui1"></view>
		</template>
	</fixtitletopVue>
  <view class="con">
	  <view class="tit">
		   重新设置密码
	  </view>
	  <view class="tt">密码要求：密码要大于5位</view>
	  <input  password   v-model="inputdata" type="text" focus placeholder="请输入密码"/>
	  <button :class="{bluebg:isok}" :disabled="!isok" class="butt" @click="sok">完成</button>
  </view>
</template>

<script setup>
	import fixtitletopVue from '../../components/fixtitletop/fixtitletop.vue';
	import {computed, ref} from 'vue'
	import {getupdatepassword} from "@/api/index.js"
	import {onLoad} from '@dcloudio/uni-app'
	const inputdata=ref('')
	const phone=ref()
	const isok=computed(()=>{
		return inputdata.value.trim().length>5 
	})
	const back=()=>{
		uni.navigateBack()
	}
	const sok=async ()=>{
		const data={
			phone:phone.value,
			password:inputdata.value
		}
		const rudata=await getupdatepassword(data)
		if(rudata.code==200){
			uni.showToast({
				title:"修改成功！",
				icon:"none"
			})
			setTimeout(()=>{
				uni.navigateTo({
					url:"/pages/usernamelogin/usernamelogin"
				})
			},2000)
		}
	}
	onLoad(e=>{
		 phone.value=e.phone
	})
</script>

<style lang="scss" scoped>
	.iconfont{
		font-size: 25rpx;
	}
	.con{
		padding: 0 50rpx;
		.tit{
			font-size: 45rpx;font-weight: 700;
			margin-top: 50rpx;
		}
		.tt{
			font-size: 24rpx;
			margin-top: 10rpx;
			color: #7b7b7b;
		}
		input{
			width: 100%;
			height: 90rpx;
			font-size: 25rpx;background-color: #f8f8f8;
			border-radius: 10rpx;
			padding-left: 20rpx;
			margin-top: 120rpx;
		}
		.butt{
			height: 90rpx;
			width: 100%;
			border-radius: 10rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 25rpx;
			color: #fff;
			background-color: #dfdfdf;
			margin-top: 150rpx;
		}
	}
</style>
